package com.apkplug.test.bundle;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.content.IntentCompat;
import android.view.View;
import android.widget.EditText;

public class Main2Activity extends Activity implements View.OnClickListener {

    private EditText mEditText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.plugin_xxx_activity_main2);

        mEditText = (EditText) findViewById(R.id.et_value);

        findViewById(R.id.btn_jump).setOnClickListener(this);
    }

    @Override
    public void finish() {
        Intent intent = new Intent();
        intent.putExtra("value", mEditText.getText().toString());
        setResult(RESULT_OK, intent);
        super.finish();
    }

    @Override
    public void onClick(View v) {
        Intent intent = IntentCompat.makeRestartActivityTask(new ComponentName(this, "com.apkplug.test.MainActivity"));
        startActivity(intent);
//        finish();
    }
}
